#include <stdio.h>
#include <string.h>

void *MyStrtok(char *dest,const char *demil)
{
    static char *next = NULL;
    if(dest != NULL)
    {
        char *target = strstr(dest,demil);
        if(target == NULL)
        return dest;
        *target = '\0';
        next = target + strlen(demil);
        return dest;
    }
    else 
    {
        if(next == NULL)
        {
            return NULL;
        }
        else
        {
            char *target = strstr(next,demil);
            if(target == NULL)
            {
                char *returnValue = next;
                next = NULL;
                return returnValue;
            }
            *target = '\0';
            char *returnValue = next;
            next = target + strlen(demil);
            if(*next == '\0')
            next = NULL;
            return returnValue;  
        } 
    }
    
}

int main()
{
    char s3[] = "zhangsan,lisi,wangwu";
    char *p = MyStrtok(s3,",");
    while(p != NULL)
    {
        printf("%s\n",p);
        p = MyStrtok(NULL,",");
    }
}